﻿package plugin.roleN
{
    import com.core.*;
    import com.sh.game.control.*;
    import manager.*;
    import plugin.newvip.model.*;
    import plugin.roleN.model.*;

    public class RoleControl extends ModuleControl
    {

        public function RoleControl(param1:Object)
        {
            super(param1);
            return;
        }// end function

        override public function update(param1:Obproxy, param2:ProxyChange) : void
        {
            var _loc_3:int = 0;
            var _loc_4:int = 0;
            if (param1.getName() == "role")
            {
                if (param2.property == "init")
                {
                    this.target.Init(UserData.getUserData(), param2.newvalue);
                }
                else if (param2.property == "putOn")
                {
                    PluginManager.instance.sendToServer("role", CMDRole.PutOn, param2.newvalue);
                }
                else if (param2.property == "onarm")
                {
                    this.target.onArm(param2.newvalue);
                }
                else if (param2.property == "updaterein")
                {
                    if (!this.target._isOther)
                    {
                        this.target.updaterein();
                    }
                }
                else if (param2.property == "SetGuanzhi")
                {
                    if (param2.newvalue[0] == UserData.getUserData("id"))
                    {
                        if (!this.target._isOther)
                        {
                            this.target.SetGuanzhi(param2.newvalue[1]);
                        }
                    }
                }
                else if (param2.property == "offarm")
                {
                    if (!this.target._isOther)
                    {
                        this.target.offArm(int(param2.newvalue));
                    }
                }
                else if (param2.property == "updaterole")
                {
                    if (!this.target._isOther)
                    {
                        this.target.updateRole(param2.newvalue);
                    }
                }
                else if (param2.property == "bagtorole")
                {
                    if (!this.target._isOther)
                    {
                        this.target.BagToRole(param2.newvalue.data, param2.newvalue.globalpoint);
                    }
                }
                else if (param2.property == "updatehpmp")
                {
                    this.target.UpdateHpMp(param2.newvalue);
                }
                else if (param2.property == "durables")
                {
                    if (!this.target._isOther)
                    {
                        this.target.UpdateDurables(param2.newvalue);
                    }
                }
                else if (param2.property == "updateAbilityBuf")
                {
                    if (!this.target._isOther)
                    {
                        this.target.updateAbilityBuf(param2.newvalue);
                    }
                }
                else if (param2.property == "setUnionName")
                {
                    if (param2.newvalue[0] == UserData.getUserData("id"))
                    {
                        if (!this.target._isOther)
                        {
                            this.target.setUnionName(param2.newvalue[1]);
                        }
                    }
                }
                else if (param2.property == "UpdateAbility")
                {
                    if (!this.target._isOther)
                    {
                        this.target.UpdateAbility(param2.newvalue);
                    }
                }
                else if (param2.property == "showjm")
                {
                    this.target.jmpage.show();
                }
                else if (param2.property == "updateTitle")
                {
                }
                else if (param2.property == "updatetitles")
                {
                }
                else if (param2.property == "refreshrole")
                {
                    this.target.refresh();
                }
                else if (param2.property == "refreshvip")
                {
                    if (!this.target._isOther)
                    {
                        this.target._vipatt = VipCheck.hasfuncAttme(20);
                        this.target._vipattstr = VipCheck.hasfuncAttme(15);
                        this.target.updatePro();
                    }
                }
                else if (param2.property == "showpowsp")
                {
                    if (!this.target._isOther)
                    {
                        this.target.showpowsp();
                    }
                }
                else if (param2.property == "updatePowArr")
                {
                    if (!this.target._isOther)
                    {
                        this.target.updatePowArr(param2.newvalue);
                    }
                }
                else if (param2.property == "showBindBuffer")
                {
                    this.target.roleBuffer.addBuffer(param2.newvalue);
                }
                else if (param2.property == "updateBufferLevel")
                {
                    if (this.target.visible)
                    {
                        this.target.roleBuffer.updateRoleLevel();
                    }
                }
                else if (param2.property == "showBaoshiCount")
                {
                    this.target.showBaoshiCount();
                }
                else if (param2.property == "getNeiGongInfo")
                {
                }
                else if (param2.property == "updateNeiGongCount")
                {
                    this.target.neigong.updateNeiGongCount(param2.newvalue);
                }
                else if (param2.property == "neigong")
                {
                }
                else if (param2.property == "updateNeiGongExp")
                {
                    this.target.neigong.updateNeiGongExp(param2.newvalue);
                }
                else if (param2.property == "showNeiGongCount")
                {
                    this.target.showNeiGongCount(param2.newvalue);
                }
                else if (param2.property == "showShenZhuangBuffer")
                {
                    this.target.roleBuffer.showShenZhuangBuffer();
                }
            }
            else if (param1.getName() == "data")
            {
                if (param2.property == "user")
                {
                    this.target.updateRole(param2.newvalue);
                }
            }
            else if (param1.getName() == "skill")
            {
                if (param2.property == "update")
                {
                    this.target.skillUpdate();
                }
                else if (param2.property == "setskill")
                {
                    this.target.skillUpdate();
                }
                else if (param2.property == "showkey")
                {
                    this.target.skillShowkeys(param2.newvalue);
                }
            }
            else if (param1.getName() == "zhuan")
            {
                if (param2.property == "getatt")
                {
                    this.target.zhuansheng.init();
                    this.target.showRein(param2.newvalue);
                }
                else if (param2.property == "updatezhuan")
                {
                    this.target.zhuansheng.init();
                }
                else if (param2.property == "reinEnergy")
                {
                    this.target.zhuansheng.reinEnergy(param2.newvalue);
                    this.target.showRein(param2.newvalue);
                }
                else if (param2.property == "zhuansucc")
                {
                    this.target.zhuansheng.zhuansucc();
                    this.target.showRein(param2.newvalue);
                    _loc_3 = UserData.getBagData("flyuppower");
                    this.target.showFlyJ(_loc_3);
                }
            }
            else if (param1.getName() == "baoshi")
            {
                if (param2.property == "change")
                {
                    this.target.baoshi.changeBaoShiInfo(param2.newvalue);
                }
                else if (param2.property == "baoshiInfo")
                {
                    this.target.baoshi.showBaoShiInfo(param2.newvalue);
                }
                else if (param2.property == "buwei")
                {
                    this.target.baoshi.openItem(param2.newvalue);
                }
                else if (param2.property == "addItem")
                {
                    if (this.target.visible)
                    {
                        this.target.baoshi.showBagItem();
                    }
                }
                else if (param2.property == "updateShengji")
                {
                    this.target.baoshi.updateShengji(param2.newvalue);
                }
                else if (param2.property == "updatebsfg")
                {
                    if (PluginManager.instance.getPluginState("role") == "open")
                    {
                        this.target.baoshi.showUpdateItem();
                    }
                }
                else if (param2.property == "updateHeCheng")
                {
                    this.target.baoshi.heChengSuccess(param2.newvalue);
                }
            }
            else if (param1.getName() == "fashion")
            {
                if (param2.property == "init")
                {
                    this.target.fashion.initShowJiHuo(param2.newvalue);
                }
                else if (param2.property == "changeFashion")
                {
                    this.target.fashion.showQiCheng(param2.newvalue);
                }
            }
            else if (param1.getName() == "feishen")
            {
                if (param2.property == "init")
                {
                    if (this.target.feishen.visible)
                    {
                        this.target.feishen.init(param2.newvalue);
                    }
                }
                else if (param2.property == "GetFlyuppower")
                {
                    if (this.target.feishen.visible)
                    {
                        this.target.feishen.xwEXP(param2.newvalue);
                        this.target.feishen.init(null);
                    }
                    this.target.showFlyJ(param2.newvalue);
                }
                else if (param2.property == "huodexiewei")
                {
                    if (this.target.feishen.visible)
                    {
                        this.target.feishen.init(null);
                    }
                    this.target.showFlyJ(param2.newvalue);
                }
                else if (param2.property == "playMC")
                {
                    _loc_4 = UserData.getBagData("flyuppower");
                    this.target.showFlyJ(_loc_4);
                    this.target.feishen.playMC();
                }
            }
            return;
        }// end function

    }
}
